.class Lcom/zuiapps/library/download/UpgradeFileDownloadManager$1;
.super Landroid/content/BroadcastReceiver;
.source "UpgradeFileDownloadManager.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/zuiapps/library/download/UpgradeFileDownloadManager;->registerReceiver(Landroid/content/Context;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$0:Lcom/zuiapps/library/download/UpgradeFileDownloadManager;


# direct methods
.method constructor <init>(Lcom/zuiapps/library/download/UpgradeFileDownloadManager;)V
    .registers 2
    .param p1, "this$0"    # Lcom/zuiapps/library/download/UpgradeFileDownloadManager;

    .prologue
    .line 74
    iput-object p1, p0, Lcom/zuiapps/library/download/UpgradeFileDownloadManager$1;->this$0:Lcom/zuiapps/library/download/UpgradeFileDownloadManager;

    invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V

    return-void
.end method


# virtual methods
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
    .registers 15
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "intent"    # Landroid/content/Intent;

    .prologue
    .line 77
    const/4 v4, 0x0

    .line 79
    .local v4, "myDownload":Landroid/database/Cursor;
    :try_start_1
    const-string v8, "extra_download_id"

    const-wide/16 v10, -0x1

    invoke-virtual {p2, v8, v10, v11}, Landroid/content/Intent;->getLongExtra(Ljava/lang/String;J)J

    move-result-wide v6

    .line 80
    .local v6, "reference":J
    new-instance v5, Landroid/app/DownloadManager$Query;

    invoke-direct {v5}, Landroid/app/DownloadManager$Query;-><init>()V

    .line 81
    .local v5, "myDownloadQuery":Landroid/app/DownloadManager$Query;
    const/4 v8, 0x1

    new-array v8, v8, [J

    const/4 v9, 0x0

    aput-wide v6, v8, v9

    invoke-virtual {v5, v8}, Landroid/app/DownloadManager$Query;->setFilterById([J)Landroid/app/DownloadManager$Query;

    .line 83
    iget-object v8, p0, Lcom/zuiapps/library/download/UpgradeFileDownloadManager$1;->this$0:Lcom/zuiapps/library/download/UpgradeFileDownloadManager;

    iget-object v8, v8, Lcom/zuiapps/library/download/UpgradeFileDownloadManager;->mZMDownloadManager:Landroid/app/DownloadManager;

    invoke-virtual {v8, v5}, Landroid/app/DownloadManager;->query(Landroid/app/DownloadManager$Query;)Landroid/database/Cursor;

    move-result-object v4

    .line 84
    invoke-interface {v4}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v8

    if-eqz v8, :cond_5f

    .line 85
    const-string v8, "local_filename"

    invoke-interface {v4, v8}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v1

    .line 86
    .local v1, "fileNameIdx":I
    const-string v8, "local_uri"

    invoke-interface {v4, v8}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v3

    .line 88
    .local v3, "fileUriIdx":I
    invoke-interface {v4, v1}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v0

    .line 89
    .local v0, "fileName":Ljava/lang/String;
    invoke-interface {v4, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v2

    .line 90
    .local v2, "fileUri":Ljava/lang/String;
    const-string v8, ""

    new-instance v9, Ljava/lang/StringBuilder;

    invoke-direct {v9}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v9, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    const-string v10, "fileUri ==="

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v9, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v9}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-static {v8, v9}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 91
    iget-object v8, p0, Lcom/zuiapps/library/download/UpgradeFileDownloadManager$1;->this$0:Lcom/zuiapps/library/download/UpgradeFileDownloadManager;

    new-instance v9, Ljava/io/File;

    invoke-direct {v9, v0}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v8, p1, v9}, Lcom/zuiapps/library/download/UpgradeFileDownloadManager;->installApk(Landroid/content/Context;Ljava/io/File;)V
    :try_end_5f
    .catch Ljava/lang/Throwable; {:try_start_1 .. :try_end_5f} :catch_65
    .catchall {:try_start_1 .. :try_end_5f} :catchall_6c

    .line 96
    .end local v0    # "fileName":Ljava/lang/String;
    .end local v1    # "fileNameIdx":I
    .end local v2    # "fileUri":Ljava/lang/String;
    .end local v3    # "fileUriIdx":I
    :cond_5f
    if-eqz v4, :cond_64

    .line 97
    invoke-interface {v4}, Landroid/database/Cursor;->close()V

    .line 101
    .end local v5    # "myDownloadQuery":Landroid/app/DownloadManager$Query;
    .end local v6    # "reference":J
    :cond_64
    :goto_64
    return-void

    .line 93
    :catch_65
    move-exception v8

    .line 96
    if-eqz v4, :cond_64

    .line 97
    invoke-interface {v4}, Landroid/database/Cursor;->close()V

    goto :goto_64

    .line 96
    :catchall_6c
    move-exception v8

    if-eqz v4, :cond_72

    .line 97
    invoke-interface {v4}, Landroid/database/Cursor;->close()V

    :cond_72
    throw v8
.end method
